package clues.bihu.cluesaccident

import cn.jpush.android.api.JPushInterface
import com.orhanobut.logger.AndroidLogAdapter
import com.orhanobut.logger.Logger
import com.orhanobut.logger.PrettyFormatStrategy
import io.flutter.app.FlutterApplication


/**
 *@Date 2018/7/10
 *@Author Mr.WEI
 *@Description application
 **/
class ClueBaseApp : FlutterApplication() {

    companion object {
        var appContext: ClueBaseApp? = null
    }

    override fun onCreate() {
        super.onCreate()
        appContext = this
        initLogger()
        initJPush()
    }

    private fun initJPush() {
        JPushInterface.setDebugMode(true)
        JPushInterface.init(this)
    }


    private fun initLogger() {
        val formatStrategy = PrettyFormatStrategy.newBuilder()
                .tag(packageName)
                .build()
        Logger.addLogAdapter(object : AndroidLogAdapter(formatStrategy) {
            override fun isLoggable(priority: Int, tag: String?): Boolean = BuildConfig.DEBUG
        })
    }


}

